package ccrClasses.layer2;

import ccrClasses.ICcr;

public class ProductName implements ICcr {
	
	public final static String OPEN_TAG = "<ProductName>";

	public final static String CLOSE_TAG = "</ProductName>";
	
	private Text text;
	
	private Code code;
	
	public ProductName(Text text, Code code) {
		super();
		this.text = text;
		this.code = code;
	}

	public ProductName(Code code) {
		super();
		this.code = code;
	}

	public ProductName(Text text) {
		super();
		this.text = text;
	}
	
	public ProductName() {
		super();
	}

	@Override
	public String constructCcrString() {
		String ccrProductName = OPEN_TAG;
		if(text != null){
			ccrProductName = ccrProductName + text.constructCcrString();
		}
		
		if(code != null){
			ccrProductName = ccrProductName + code.constructCcrString();
		}
		
		ccrProductName += CLOSE_TAG;
		
		return ccrProductName;
		
		
	}

	/**
	 * @return the text
	 */
	public Text getText() {
		return text;
	}

	/**
	 * @param text the text to set
	 */
	public void setText(Text text) {
		this.text = text;
	}

	/**
	 * @return the code
	 */
	public Code getCode() {
		return code;
	}

	/**
	 * @param code the code to set
	 */
	public void setCode(Code code) {
		this.code = code;
	}

}
